import time

from celery import Celery

from app_init import redis_db
# from model import CommonReport
from my_logger import logger
from abc import ABC
from celery import Task
# app = Celery("worker",
#              broker=f"redis://:Kean@123@www.xiuwen.work:13361/{redis_db}",
#              backend=f"redis://:Kean@123@www.xiuwen.work:13361/5", )
app = Celery("domodo")
app.config_from_object('config')

#
# class ObjectMaker:
#     def __init__(self, cls, *args, **kwargs):
#         for key, value in kwargs.items():
#             if isinstance(value, dict):
#                 kwargs[key] = ObjectMaker(cls, **value)
#             elif isinstance(value, list):
#                 kwargs[key] = [ObjectMaker(cls, **item) if isinstance(item, dict) else item for item in value]
#         self.__dict__.update(kwargs)
#
#     def to_object(dict_data):
#         if isinstance(dict_data, dict):
#             for key, value in dict_data.items():
#                 if isinstance(value, dict):
#                     dict_data[key] = ObjectMaker.to_object(value)
#                 elif isinstance(value, list):
#                     dict_data[key] = [ObjectMaker.to_object(item) if isinstance(item, dict) else item for item in value]
#             return ObjectMaker(dict, **dict_data)
#         return dict_data
#
